From: Jonas Dreßler Date: Wed, 11 Sep 2019 12:36:18 +0000 (+0200) Subject: extensionSystem: Check if extension exists before accessing property X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~811^2^2~102 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=e76877c4b889590251fb9b646e7283480979e089;p=gnome-shell.git extensionSystem: Check if extension exists before accessing property If the extension doesn't exist in the `this._extensions` Map, we'd try to access `extension.dir` on undefined/null. So set the `dir` variable after checking if `extension` is defined. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/96 --- diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js index 47750bda3..98ef13be9 100644 --- a/js/ui/extensionSystem.js +++ b/js/ui/extensionSystem.js @@ -303,11 +303,10 @@ var ExtensionManager = class { _callExtensionInit(uuid) { let extension = this.lookup(uuid); - let dir = extension.dir; - if (!extension) throw new Error("Extension was not properly created. Call createExtensionObject first"); + let dir = extension.dir; let extensionJs = dir.get_child('extension.js'); if (!extensionJs.query_exists(null)) { this.logExtensionError(uuid, new Error('Missing extension.js'));